import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import '../screens/car/car.dart';
import '../screens/empty/empty.dart';
import '../screens/launch/launch.dart';
import '../screens/home/home.dart';
import '../screens/profile/profile.dart';
import '../screens/shopping/shopping.dart';
import '../widgets/tabbar.dart';

var launchScreenHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) => const LaunchScreen());
var tabbarHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) => const Tabbar());
var homeHandler =
    Handler(handlerFunc: (BuildContext? context, Map<String, List<String>> params) => const Home());
var profileHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) => const Profile());
var shoppingHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) => const Shopping());
var carHandler =
    Handler(handlerFunc: (BuildContext? context, Map<String, List<String>> params) => const Car());
var emptyHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) => const EmptyPage());

void defineRoutes(FluroRouter router) {
  // 根路由
  router.define('/', handler: launchScreenHandler);
  router.define('tabbar', handler: tabbarHandler);
  router.define('home', handler: homeHandler);
  router.define('profile', handler: profileHandler);
  router.define('shopping', handler: shoppingHandler);
  router.define('car', handler: carHandler);
  // notFound(404)页面特殊处理
  router.notFoundHandler = emptyHandler; //空页面
}
